<?php
function flag($obj){
    include '../../api/config.php';
    $token = $obj->token;
    $sql = "SELECT * FROM admin_user WHERE token='$token'";
    $stmt = $conn->query($sql);
    $stmt->execute();
    $result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
    $result = $stmt->fetchAll();
    if($result){
        return true;
    }else{
        return false;
    };
};

function get_msg($code,$msg,$href,$data){
    $msg_arr = array();

    if($code){
        $msg_arr['code'] = $code;
    };

    if($msg){
        $msg_arr['msg'] = $msg;
    };

    if($href){
        $msg_arr['href'] = $href;
    };

    if($data){
        $msg_arr['data'] = $data;
    };

    return json_encode($msg_arr);

};